var addVideo = {
		//保存
		saveVideo:function(){
			$("#addVideoForm").form('submit',{
				url:"../videoList/addVideo.do",
				onSubmit:function(){
					var videoName = $("#videoName").val();
					if(null == videoName || undefined == videoName || "" == videoName){
						$.messager.alert('警告','电影名称不能为空!','warning');
						return false;
					}else if(videoName.length > 50){
						$.messager.alert('警告','电影名称不能超过50个字!','warning');
						return false;
					}
				},
				success:function(data){
					if("true" == data){	//保存成功
						$.messager.alert('提示','保存成功!','info',function(){
							window.location.href = "../videoList/list.do";
						});
					}else{		//保存失败
						$.messager.alert('提示','保存失败,请检查无误后再次保存!','info');
					}
				}
			});
		}
}
//页面加载完成执行
$(function(){
	//初始化ueditor容器
	var ue_poster = UE.getEditor('container_poster', {
	    toolbars: [
	        ['fullscreen', 
	         'source', 
	         'undo', 
	         'redo', 
	         'snapscreen',
	         'preview',
	         'cleardoc',
	         'simpleupload',
	         'insertimage',
	         'emotion',
	         'link']
	    ],
	    //autoHeightEnabled: true,
	    initialFrameHeight:300,	//初始化编辑器高度,默认320
	    autoFloatEnabled: true
	    //initialFrameWidth:1000	//初始化编辑器宽度,默认1000
	});
	
	//初始化ueditor容器
	var ue_about = UE.getEditor('container_about', {
	    toolbars: [
	        ['fullscreen', 
	         'source', 
	         'undo', 
	         'redo', 
	         'snapscreen',
	         'preview',
	         'cleardoc',
	         'simpleupload',
	         'insertimage',
	         'emotion',
	         'link']
	    ],
	    //autoHeightEnabled: true,
	    initialFrameHeight:300,	//初始化编辑器高度,默认320
	    autoFloatEnabled: true
	    //initialFrameWidth:1000	//初始化编辑器宽度,默认1000
	});
	
    $('#videoName').validatebox({
        required: true,				//必须
        validType: 'length[1,50]'	//字符长度1-50
    });
    
    //初始化文件上传
    $("#container_poster").fileinput({
    	'showUpload':false,
    	allowedFileExtensions: ['jpg', 'png','gif','bmp'],	//支持的文件后缀
    	uploadUrl:'../images/video/videoPoster',			//上传路径
    	maxFileCount:1,										//允许上传最大数量
    	
    });
});